#ifndef _BLE_UNPACK__H_
#define _BLE_UNPACK__H_

#include "app_cfg.h"
#include "ble_viot.h"

enum en_ble_opcode
{
	OPCODE_BINDING					= 0x0001,
};
enum en_adv_pdu_type
{

	/******BLE VIOT******/
	BLE_VIOT_ADV		= 0x30,
	
	/********MESH********/
	MESH_PB_ADV			= 0x29,
	MESH_BEACON			= 0x2B,
	MESH_MESSAGE		= 0x2A,
	ALI_MESH_ADV		= 0x40,
	ALI_APP_IOS_V12_ADV = 0x41,
	ALI_APP_IOS_ADV 	= 0x44,
};

struct str_setup_info
{
	uint32_t 		addr;
	uint8_t 		group_index;
}__attribute__((packed));


uint8_t is_device_in_setup_list(uint8_t is_apk,struct str_setup_info* new_addr);
uint8_t find_valid_index_in_setup_list(uint8_t is_apk,struct str_setup_info* binding_addr);
uint8_t get_binding_state(void);
uint8_t get_adv_type(uint8_t* ble_payload,uint8_t payload_lenth);
uint8_t ble_viot_unpack_handler(uint8_t* adv_data,uint8_t adv_data_len);
uint8_t handle_binding(str_ble_viot_para* para);
;

#endif
